package com.jin.jpa.wrapper.util;

import com.jin.listener.SpringApplicationListener;
import org.springframework.stereotype.Component;

import javax.persistence.EntityManager;

/**
 * @Author: yuanxiuyao
 * @Date: 2024/1/4 16:18
 * @PackageName: org.example.jpa.wrapper.util
 * @Version 1.0
 */
@Component
public class EntityManagerUtils {

    public static EntityManager entityManager;

    static {
        SpringApplicationListener.addListener(applicationContext -> entityManager = applicationContext.getBean(EntityManager.class));
    }
}
